﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace Pibby.Core
{
	public class PollingSettings
	{
		public PollingSettings()
		{
			this.StartupDelay = new TimeSpan(0, 5, 0);
			this.PollingInterval = new TimeSpan(3, 0, 0);
		}

		[XmlIgnore]
		public TimeSpan StartupDelay
		{
			get;
			private set;
		}

		public int StartupDelayMilliseconds
		{
			get { return (int)this.StartupDelay.TotalMilliseconds; }
		}

		public int StartupDelayMinutes
		{
			get { return (int)this.StartupDelay.TotalMinutes; }
			set
			{
				this.StartupDelay = new TimeSpan(0, value, 0);
			}
		}

		[XmlIgnore]
		public TimeSpan PollingInterval
		{
			get;
			private set;
		}

		public int PollingIntervalMilliseconds
		{
			get { return (int)this.PollingInterval.TotalMilliseconds; }
		}

		public int PollingIntervalMinutes
		{
			get { return (int) this.PollingInterval.TotalMinutes; }
			set
			{
				this.PollingInterval = new TimeSpan(0, value, 0);
			}
		}
	}
}
